<?php
 
require 'includes/db.php';
if(isset($_POST['submit'])){

$name= $_POST['name'];

$email= $_POST['email'];
$gender= $_POST['gender'];
$designation= $_POST['designation'];
$fb_id= $_POST['fb_id'];
$twitter_id= $_POST['twitter_id'];
$ln_id= $_POST['ln_id'];
$description= $_POST['description'];

   $p_image = $_FILES['image']['name'];
        $p_image = date('ymdHis').'_'.uniqid().'_'.$p_image;
        $fileInfoArray = pathinfo($p_image);

        $src = $_FILES['image']['tmp_name'];
          $dest = "upload/$p_image";
          $isMoved = @move_uploaded_file($src, $dest);

          $_POST['image'] = $p_image;
		 
$abc= mysql_query ("INSERT INTO our_team(name, email, gender, designation, fb_id, twitter_id, ln_id, description, image) VALUES ('$name', '$email', '$gender', '$designation', '$fb_id', '$twitter_id', '$ln_id', '$description', '$p_image')") or die(mysql_error());

header('location:our_team.php');
echo 'Successfully Added';
}

require 'header.php';
 ?>
<script src="js/jquery-1.8.2.min.js" type="text/javascript"></script>
<script src="js/jquery.validate.js" type="text/javascript"></script>
<script src="js/register.jquery.js" type="text/javascript"></script>
<div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main">
    <form id="registerId" action="" method="post" enctype="multipart/form-data">
        <table class="table table-striped">
        	<thead>
        		<th colspan="2"><h4>Add New Team Member</h4></th>
        	</thead>
            <tbody>
                <tr>
                    <td width="20%" align="right">Name :</td>
                    <td width="40%" align="right">
                        <input class="form-control" type="text" name="name" value="" placeholder="Member Name" />
                    </td>
                    <td width="40%" align="right"><label for="name" generated="true" class="error"></label></td>
                </tr>
                <tr>
                    <td align="right">Email :</td>
                    <td >
                        <input class="form-control" type="email" name="email"value="" placeholder="Email" />        </td>
                    <td><label for="email" generated="true" class="error"></label></td>
                </tr>
                <tr>
                    <td align="right">Gender :</td>
                    <td >
                        <span>
                            <label><input  type="radio" name="gender" value="Male" /> Male</label>
                            <label><input  type="radio"name="gender" value="Female"/> Female</label>
                        </span>
                    </td>
                    <td><label for="gender" generated="true" class="error"></label></td>
                </tr>

                <tr>
                    <td align="right">Upload Image :</td>
                    <td >
                        <input class="form-control" type="file" name="image" value="" placeholder="My avatar is..." placeholder="image"/>       </td>
                    <td><label for="image" generated="true" class="error"></label></td>
                </tr>
                <tr>
                    <td>Designation :</td>
                    <td >
                        <input class="form-control" type="text" name="designation" value="" placeholder="Designation"/>
                    </td>
                    <td><label for="designation" generated="true" class="error"></label></td>
                </tr>
                <tr>
                    <td>Facebook Id :</td>
                    <td >
                        <input class="form-control" type="text" name="fb_id" value="https://www.facebook.com/" placeholder="Facebook URL id"/>
                    </td>
               <td align="right">&nbsp;</td>
                </tr>
                <tr>
                    <td>Twitter Id :</td>
                    <td >
                        <input class="form-control" type="text" name="twitter_id" value="https://twitter.com/" />
                    </td>
 					<td align="right">&nbsp;</td>
                </tr>
                <tr>
                    <td>linkedin Id :</td>
                    <td >
                        <input class="form-control" type="text" name="ln_id" value="" />
                    </td>
                     <td align="right">&nbsp;</td>
                </tr>
                <tr>
                    <td>Description :</td>
                    <td >
                        <input class="form-control" type="text" name="description" value="" />
                    </td>
                    <td><label for="description" generated="true" class="error"></label></td>
                </tr>
                <tr>
                    <td align="right">&nbsp;</td>
                    <td >
                        <input class="form-control" type="submit" name="submit" value="Add Member" />        </td>
                    <td align="right">&nbsp;</td>
                </tr>

            </tbody>

        </table>
    </form>
</div>